﻿namespace NavigationSampleWinForms.Views.Context
{
    using System;

    using Smart.Navigation;
    using Smart.Navigation.Context;

    /// <summary>
    /// 
    /// </summary>
    [View(ViewId.ContextInput1)]
    public partial class ContextInput1View : AppViewBase
    {
        [ViewContext]
        protected InputContext Context { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public ContextInput1View()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="args"></param>
        public override void OnViewOpen(ViewForwardEventArgs args)
        {
            // ファンクションキー
            FunctionCotrol.UpdateFunctionKeys(null);

            // 表示
            Data1Text.Text = Context.Data1;
        }

        /// <summary>
        /// 
        /// </summary>
        public override void OnViewClose()
        {
            // 保存
            Context.Data1 = Data1Text.Text;
        }

        /// <summary>
        /// 
        /// </summary>
        public override void OnButtonExit()
        {
            Navigator.Forward(ViewId.Menu);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PrevButtonClick(object sender, EventArgs e)
        {
            Navigator.Forward(ViewId.Menu);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NextButtonClick(object sender, EventArgs e)
        {
            Navigator.Forward(ViewId.ContextInput2);
        }
    }
}